package com.renwei.yunlong.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.renwei.yunlong.R;
import com.renwei.yunlong.bean.NewDetailsTypesBean;
import com.zyf.fwms.commonlibrary.base.baseadapter.BaseRecyclerViewAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 对象详情  类型 Adapter
 * <p>
 * Created by Administrator on 2017/9/30.
 */

public class NewDetailsTypesAdapter extends BaseRecyclerViewAdapter<NewDetailsTypesBean.RowsBean.PropertyListBean> {

    public NewDetailsTypesAdapter(Context context) {
        super(context);
    }

    @Override
    public NewDetailsTypesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_new_details_types, parent,false);
        return new NewDetailsTypesViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder rholder, int position) {
        NewDetailsTypesViewHolder holder = (NewDetailsTypesViewHolder) rholder;

        NewDetailsTypesBean.RowsBean.PropertyListBean rows = mList.get(position);

        holder.tvKey.setText(rows.getNamea());
        holder.tvValue.setText(rows.getValuea());
    }

    @Override
    public int getItemCount() {
        return mList == null ? 0 : mList.size();
    }

    static class NewDetailsTypesViewHolder extends RecyclerView.ViewHolder {
        @Bind(R.id.tv_key)
        TextView tvKey;
        @Bind(R.id.tv_value)
        TextView tvValue;

        public NewDetailsTypesViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
